#include "SplineHelper.h"

CIwFVec2 QuadraticBezierCurveInterpoliate( CIwFVec2 p0, CIwFVec2 p1, CIwFVec2 p2, float t )
{
	CIwFVec2 pos = (1-t) * (1-t) * p0 + 2* (1-t)*t*p1 + (t * t) * p2;

	return pos;
}

CIwFVec2 CatmullRomSpline( const CIwFVec2 &p0, const CIwFVec2 &p1, const CIwFVec2 &p2, const CIwFVec2 &p3, float t )
{
	CIwFVec2 new_pos = 0.5 *( 
			(2 * p1) + 
			(-p0 + p2) * t +
			(2*p0 - 5*p1 + 4*p2 - p3) * (t * t) +
			(-p0 + 3*p1- 3*p2 + p3) * (t * t * t) );
			
	return new_pos;
}